package first.codeTop.alibaba;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName LC145
 * @description:
 * @author: 荣燊
 * @create: 2021-10-18 19:58
 **/
public class LC145 {
    // 二叉树的后序遍历
    public static void main(String[] args) {

    }

    List<Integer> result = new ArrayList<>();

    public List<Integer> postorderTraversal(TreeNode root) {
        dfs(root);
        return result;
    }

    public void dfs(TreeNode root) {
        if (root == null) {
            return;
        }
        dfs(root.left);
        dfs(root.right);
        result.add(root.val);
    }
}
